#!/bin/bash

show_help() {
  echo -e "check kernel parameters at runtime"
  echo -e "Usage:"
  echo -e "$title [options] check"
  echo -e "Options:"
  echo -e "\t--help | -h          show this help and exit"
}

cmdopts=$(getopt --longoptions title:,help \
                     --options +h -- "$@")

# set positional parameters
eval set -- "$cmdopts"

title=do_sysctl

while true; do
  case "$1" in
    --title )
        title="$2"
        shift 2;;
    -h | --help )
        show_help
        exit ;;
    -- ) shift; break ;;
    * ) break ;;
  esac
done

action=$1

[ -n "$action" ] || action=check

[ "$action" == "check" ] || { show_help; exit; }

sudo ssh root@$controller \
 sysctl_check $*

